|
|
|
|
|
|
|
Data Table Rows and Columns |
|
|
|
|
|
|
|
|
By combining data fields and data records, you create the most common element of relational databasesthe data table. This element contains multiple data records, and each data record contains multiple data fields (see Figure 2.3). |
|
|
|
|
|
|
|
|
Figure 2.3.
An example of a data table in a database. |
|
|
|
|
|
|
|
|
Just as each data record contains related data fields (LastName, FirstName, and AccountBalance), each data table contains related records. Data tables have meaningful names (Customer Table or Invoice Table, for example) in the same way that data fields have meaningful names (LastName, FirstName, AccountBalance, and so on). These names help you and other users to remember the contents of the elements (table elements and field elements). |
|
|
|
|
|
|
|
|
Just as a data record can contain several related data fields, a database can contain several related tables. Using relationships is a very efficient way to store complex data. For example, a table storing customer names could be related to another table storing the names of items the customer has bought, which could be related in turn to a table storing the names of all the items you have to sell. By establishing meaningful relationships between data tables, you can create flexible data structures that are easy to maintain. |
|
|
|
|
|
|
|
|
You establish relationships between data tables by using pointer or qualifier fields in your data table. |
|
|
|
|
|
|
|
|
You use qualifier fields to point to records in other tables that have additional information. Qualifier fields usually describe what's known as one-to-one relationships. A good example of a one-to-one relationship is the relationship between a single customer record and a single record in the shipping address table (see Figure 2.4). |
|
|
|
|
|